home *** CD-ROM | disk | FTP | other *** search
- /********************************************************************************/
- /* */
- /* ARTest.c - A/ROSE driver test tool. */
- /* */
- /* Richard W. Mincher. February 20, 1990. */
- /* */
- /* Copyright © 1990, Apple Computer, Inc. All rights reserved. */
- /* */
- /********************************************************************************/
-
-
- #include "types.h"
- #include "stdio.h"
- #include "OSUtils.h"
-
- #include "Desk.h"
- #include "files.h"
- #include "memory.h"
- #include "CursorCtl.h"
-
- #include "ARDriver.h"
-
- short ref;
-
- main()
- {
- short err;
- long i, j, k;
- ParamBlockRec pbrec;
- ParamBlockRec pbrec1;
- char temp[101];
-
- InitCursorCtl(0);
- for(i=0; i < sizeof(ParamBlockRec); i++)
- {
- ((char *)(&pbrec))[i] = 0;
- ((char *)(&pbrec1))[i] = 0;
- }
- fprintf( stderr, "Opendriver called.\n");
- err = AROpenDriver( "\pSerial NB:snbaB3", &ref );
- fprintf( stderr, "Opendriver returned. ioResult = %d\n", err);
- pbrec.cntrlParam.csCode = 10;
- pbrec.cntrlParam.csParam[0] = 0x101;
- pbrec.cntrlParam.csParam[1] = 0x1113;
- pbrec.cntrlParam.csParam[2] = 0x0;
- pbrec.cntrlParam.csParam[3] = 0x101;
- err = ARPBControl (&pbrec, 0 );
- fprintf( stderr, "Control returned. ioResult = %d\n", err);
- err = ARPBStatus (&pbrec, 0 );
- fprintf( stderr, "Status returned. ioResult = %d\n", err);
- for(i=0; i < 100; i++)
- {
- pbrec.ioParam.ioBuffer = "Hello\nHello\nHello\nHello\nHello\nHello\n";
- pbrec.ioParam.ioReqCount = 36;
- err = ARPBWrite (&pbrec, 1 );
- fprintf( stderr, "Write returned. ioResult = %d\n", err);
- pbrec1.ioParam.ioBuffer = "World\nWorld\nWorld\nWorld\nWorld\nWorld\n";
- pbrec1.ioParam.ioReqCount = 36;
- err = ARPBWrite (&pbrec1, 1 );
- fprintf( stderr, "Write returned. ioResult = %d\n", err);
- while ((pbrec.ioParam.ioResult > 0) || (pbrec1.ioParam.ioResult > 0))
- {
- SpinCursor(1);
- PushAIPC();
- }
- }
- for(i=0; i < 5; i++)
- {
- for(j=0; j < 5; j++)
- {
- Delay( 60 * 4, &k );
- pbrec.cntrlParam.csCode = 2;
- err = ARPBStatus (&pbrec, 0 );
- fprintf( stderr, "Status returned. ioResult = %d length = %d\n",
- err, pbrec.cntrlParam.csParam[1] );
- }
- pbrec.ioParam.ioBuffer = temp;
- pbrec.ioParam.ioReqCount = 100;
- err = ARPBRead (&pbrec, 1 );
- while (pbrec.ioParam.ioResult > 0)
- {
- SpinCursor(1);
- PushAIPC();
- }
- temp[pbrec.ioParam.ioActCount] = 0;
- fprintf( stderr, "Read returned. ioResult = %d\n", err);
- fprintf( stderr, "Read length = %d data = \"%s\"\n",
- pbrec.ioParam.ioActCount, temp );
- }
- err = ARCloseDriver( ref );
- fprintf( stderr, "Close returned. ioResult = %d\n", err);
- exit(0);
- }
-